<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>以_或$开头的属性不会被Vue实例代理</title>
    <!--引入Vue库-->
    <script src="vue.js"></script>
  </head>
  <body>
    <div id="app">{{ message }}</div>
    <script>
      var vm = new Vue({
        el: "#app",
        data: {
          message: "请登录!",
          _userName: "admin",
          $password: "123456",
        },
      });
      console.log(vm.message); //请登录!
      console.log(vm._userName); //undefined
      console.log(vm.$data._userName); //'admin'
      console.log(vm.$password); //undefined
      console.log(vm.$data.$password); //'123456'
    </script>
  </body>
</html>
